# create archive directory

dstdir=$1
[ ! -d $dstdir ] && mkdir $dstdir

# generate 128 bit xoron matrix

arch=128
[ ! -d $dstdir/$arch ] && mkdir $dstdir/$arch

if [ ! -e $dstdir/$arch/xmatrix_comp_file.xf ] || [ ! -s $dstdir/$arch/xmatrix_comp_file.xf ] ; then
    str="
    xrnlib-cli \
        --encoding-conf -compiled-param -no-password \
        --permutation-conf -arch $arch \
        --logging-conf -force-write \
        --mine-xmatrix-comp-rnd -random -xmatrix-comp $dstdir/$arch/xmatrix_comp_file.xf
    "
    echo ""; echo $str; echo ""
    eval $str
fi

# generate 256 bit xoron matrix

arch=256

[ ! -d $dstdir/$arch ] && mkdir $dstdir/$arch

if [ ! -e $dstdir/$arch/xmatrix_comp_file.xf ] || [ ! -s $dstdir/$arch/xmatrix_comp_file.xf ] ; then
    str="
    xrnlib-cli \
        --encoding-conf -compiled-param -no-password \
        --permutation-conf -arch $arch \
        --logging-conf -force-write \
        --mine-xmatrix-comp-ot -random -xmatrix-comp $dstdir/$arch/xmatrix_comp_file.xf
    "
    echo ""; echo $str; echo ""
    eval $str
fi
